package com.app.mapper;

import com.app.pojo.Item;
import com.app.pojo.Order;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface OrderMapper {
    @Insert("insert into `Order`(status,user_id,item_id,order_account,order_total,order_time) values (#{status},#{user_id},#{item_id},#{order_account},#{order_total},#{order_time})")
    void insert(Order order);
    @Select("select * from `Order` where user_id = #{user_id}")
    List<Order> list(int user_id);
    @Select("select * from `Order` where order_id = #{order_id}")
    List<Order> list2(int order_id);
    @Select("select status from `Order` where order_id = #{order_id}")
    int select(int order_id);
    @Delete("delete from `Order` where order_id = #{order_id}")
    void delete(int order_id);
    @Update("update `Order` set user_id = #{user_id},item_id = #{item_id},order_account = #{order_account},order_total = #{order_total},status = #{status},order_time = #{order_time} where order_id = #{order_id}")
    void update(Order order);
    @Select("select * from `Order`")
    List<Order> selectAll();
}
